#pragma once

#include "RegistryValue.h"
#include <vector>

static std::wstring GetMyDocumentsDir()
{
    std::vector<wchar_t> myDocPath;
    myDocPath.assign(MAX_PATH + 1, 0);

    if (!SHGetSpecialFolderPath(NULL, (LPTSTR)&myDocPath[0], CSIDL_PERSONAL, FALSE))
        return std::wstring();

    return std::wstring((LPTSTR)&myDocPath[0]);
}

class Options
{
public:

    Options(const std::wstring& root, HKEY hKey)
        : workingDir(root + L"WorkingDir", hKey)
        , fontName(root + L"FontName", hKey)
        , fontSize(root + L"FontSize", hKey)
        , fontBold(root + L"FontBold", hKey)
        , newInUnicode(root + L"NewInUnicode", hKey)
    {
        if (!workingDir.exists())
        {
#ifdef _DEBUG
            workingDir = GetMyDocumentsDir() + L"\\MemoDBG\\";
#else
            workingDir = GetMyDocumentsDir() + L"\\Memo\\";
#endif // _DEBUG
        }

        if (!newInUnicode.exists())
            newInUnicode = false;
    }

    std::wstring GetWorkingDir() { return (std::wstring)workingDir; }
    bool NewInUnicode() { return (bool)newInUnicode; }

private:
    
    registry_string<std::wstring> workingDir;
    
    registry_string<std::wstring> fontName;
    registry_string<int>          fontSize;
    registry_string<bool>         fontBold;

    registry_string<bool>         newInUnicode;
};